package domain;

import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.handler.*;
import org.eclipse.jetty.servlet.*;

public class Main {
	
	public static void main(String[] args) {		
		// Open a server
		//Server server = new Server(Integer.parseInt(args[0]));
		Server server = new Server(7000);

		
		ResourceHandler resource_handler = new ResourceHandler();
		
		resource_handler.setDirectoriesListed(true);
		
		resource_handler.setWelcomeFiles(new String[]{"blog.html"});
		
		resource_handler.setResourceBase("D:\\Program Files\\Dropbox\\SOA\\27.2.12\\soa-proj\\bologdart");
		
		
		ServletContextHandler ctx = 
			new ServletContextHandler(ServletContextHandler.SESSIONS);

		ctx.addServlet(new ServletHolder(new Blog()), "/prj/*");
		HandlerList list = new HandlerList();
		list.addHandler(ctx);
		
		list.addHandler(resource_handler);
		
		server.setHandler(list);
		
		try {
			server.start();
			server.join();
		} catch (Throwable e) {
			e.printStackTrace();
		}
	}
}   